package cn.edu.lingnan.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;

@Controller
public class HelloController {

    @ResponseBody
    @RequestMapping("/hello")
    public String hello(){
        return "Hello,World";
    }



    //根据thymeleaf的语法，他会自动去找类路径下的/templates/success.html
    //classpath:/tempmlates/success.html
    //查出一些数据，在页面展示
    @RequestMapping("/success")
    public String success(Map<String, Object> map){

        map.put("hello","<h1>你好</h1>");
        map.put("users", Arrays.asList("zhangsan","lisi","wangwu"));
        return "success";
    }
}
